//
// Created by Wirano on 2020/11/13.
//

#ifndef ANO_PORT_DRV_SPL06_H
#define ANO_PORT_DRV_SPL06_H

#include "stm32f4xx_hal.h"

#define CONTINUOUS_PRESSURE     1
#define CONTINUOUS_TEMPERATURE  2
#define CONTINUOUS_P_AND_T      3
#define PRESSURE_SENSOR     0
#define TEMPERATURE_SENSOR  1

struct spl0601_calib_param_t {
    int16_t c0;
    int16_t c1;
    int32_t c00;
    int32_t c10;
    int16_t c01;
    int16_t c11;
    int16_t c20;
    int16_t c21;
    int16_t c30;
};

struct spl0601_t {
    struct spl0601_calib_param_t calib_param;/**<calibration data*/
    uint8_t chip_id; /**<chip id*/
    int32_t i32rawPressure;
    int32_t i32rawTemperature;
    int32_t i32kP;
    int32_t i32kT;
};

void Drv_SPL06CSPin_Init(void);

uint8_t Drv_Spl0601_Init(void);

float Drv_Spl0601_Read(void);

#endif //ANO_PORT_DRV_SPL06_H
